/* Icon 组件样式 */
.myui-icon {
  display: inline-block;
  flex-shrink: 0;
  transition: all var(--transition-fast, 150ms ease-in-out);
  color: currentColor;
}

/* 尺寸变体 */
.myui-icon--xs {
  width: 0.75rem;
  height: 0.75rem;
}

.myui-icon--sm {
  width: 1rem;
  height: 1rem;
}

.myui-icon--md {
  width: 1.25rem;
  height: 1.25rem;
}

.myui-icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

.myui-icon--xl {
  width: 2rem;
  height: 2rem;
}

/* 颜色变体 */
.myui-icon--primary {
  color: var(--color-primary, #3b82f6);
}

.myui-icon--secondary {
  color: var(--color-secondary, #64748b);
}

.myui-icon--success {
  color: var(--color-success, #10b981);
}

.myui-icon--warning {
  color: var(--color-warning, #f59e0b);
}

.myui-icon--danger {
  color: var(--color-danger, #ef4444);
}

.myui-icon--info {
  color: var(--color-info, #06b6d4);
}

/* 动画效果 */
.myui-icon--spin {
  animation: myui-icon-spin 1s linear infinite;
}

.myui-icon--pulse {
  animation: myui-icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.myui-icon--bounce {
  animation: myui-icon-bounce 1s infinite;
}

.myui-icon--shake {
  animation: myui-icon-shake 0.5s ease-in-out;
}

.myui-icon--ping {
  animation: myui-icon-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes myui-icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes myui-icon-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes myui-icon-bounce {
  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

@keyframes myui-icon-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-4px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(4px);
  }
}

@keyframes myui-icon-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* 翻转效果 */
.myui-icon--flip-horizontal {
  transform: scaleX(-1);
}

.myui-icon--flip-vertical {
  transform: scaleY(-1);
}

.myui-icon--flip-both {
  transform: scaleX(-1) scaleY(-1);
}

/* 可点击状态 */
.myui-icon--clickable {
  cursor: pointer;
  border-radius: var(--border-radius-sm, 4px);
  padding: 0.25rem;
  margin: -0.25rem;
}

.myui-icon--clickable:hover {
  background-color: var(--bg-secondary, #f9fafb);
  transform: scale(1.1);
}

.myui-icon--clickable:active {
  transform: scale(0.95);
}

.myui-icon--clickable:focus {
  outline: 2px solid var(--color-primary, #3b82f6);
  outline-offset: 2px;
}

/* 填充模式 */
.myui-icon--outline {
  fill: none;
}

.myui-icon--solid {
  fill: currentColor;
  stroke: none;
}

.myui-icon--duotone {
  fill: currentColor;
  fill-opacity: 0.2;
  stroke: currentColor;
}

/* 图标容器（用于徽章） */
.myui-icon-wrapper {
  position: relative;
  display: inline-block;
}

/* 徽章样式 */
.myui-icon-badge {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-danger, #ef4444);
  color: white;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  z-index: 1;
}

.myui-icon-badge--dot {
  width: 0.5rem;
  height: 0.5rem;
  min-width: 0.5rem;
  padding: 0;
}

.myui-icon-badge--number {
  font-size: 0.625rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
}

/* 徽章位置 */
.myui-icon-wrapper--top-right .myui-icon-badge {
  top: -0.25rem;
  right: -0.25rem;
}

.myui-icon-wrapper--top-left .myui-icon-badge {
  top: -0.25rem;
  left: -0.25rem;
}

.myui-icon-wrapper--bottom-right .myui-icon-badge {
  bottom: -0.25rem;
  right: -0.25rem;
}

.myui-icon-wrapper--bottom-left .myui-icon-badge {
  bottom: -0.25rem;
  left: -0.25rem;
}

/* 可复制图标样式 */
.myui-icon--copyable {
  cursor: copy;
}

.myui-icon--copyable:hover {
  opacity: 0.8;
}

.myui-icon-container {
  position: relative;
  display: inline-block;
}

/* 复制提示工具提示 */
.myui-icon-copy-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: var(--bg-inverse, #1f2937);
  color: var(--text-inverse, #ffffff);
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm, 4px);
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  animation: myui-icon-tooltip-fade 0.2s ease-out;
}

.myui-icon-copy-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--bg-inverse, #1f2937);
}

@keyframes myui-icon-tooltip-fade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .myui-icon--xs {
    width: 0.875rem;
    height: 0.875rem;
  }

  .myui-icon--sm {
    width: 1.125rem;
    height: 1.125rem;
  }

  .myui-icon--md {
    width: 1.375rem;
    height: 1.375rem;
  }

  .myui-icon--lg {
    width: 1.625rem;
    height: 1.625rem;
  }

  .myui-icon--xl {
    width: 2.125rem;
    height: 2.125rem;
  }
}
